www.gusucode.com > ROCKOA PHP协同办公OA办公系统 v2.0PHP源码程序 > ROCKOA PHP协同办公OA办公系统 v2.0/rockoa_v2.0/rockoa_v2.0/webrock/model/dailyModel.php
<?php class dailyClassModel extends Model { public function dailyfenxi($uid, $mon, $addbo=false) { $dto = c('date', true); $start = $mon.'-01'; $enddt = $dto->getenddt($mon); $jg = $dto->datediff('d', $start, $enddt); $where = "and `workdate`<='$enddt' and ifnull(`quitdt`, '$enddt')>='$start'"; if($uid!=0)$where="and `id`='$uid'"; $urows = m('admin')->getall("`isdaily`=1 $where", 'id,name'); $xiuarr = array(); $xrows = m('kq_xiu')->getall("`date` like '$mon%'"); foreach($xrows as $k=>$rs)$xiuarr[$rs['date']]=$rs['id']; $dtarr = array(); for($i=1; $i<=$jg+1; $i++){ $oi = ''.$i.''; if($i<10)$oi= '0'.$i.''; $dt = $mon.'-'.$oi.''; $dtarr[] = $dt; } $qjdb = m('kq_info'); $fxdb = m('dailyfx'); $rows = array(); foreach($urows as $k=>$rs){ $totaly = 0;//应写 $totalx = 0;//已写次数 $totalw = 0;//未写次数 $dtjoin = ''; $uid = $rs['id']; $dtarra = array(); foreach($dtarr as $dt){ $zt = ''; $xbo = true; $col = ''; if(isset($xiuarr[$dt])){ $zt = '休息日'; $col = 'green'; $xbo = false; } if($dt>=$this->rock->date)$xbo=false; //请假的 if($xbo){ if($qjdb->rows("uid='$uid' and `kind`='请假' and `status`=1 and `stime`<='$dt 09:00:00' and `etime`>='$dt 18:00:00'")>0){ $xbo = false; $zt = '请假'; $col = 'blue'; } } if($xbo){ if($this->rows("uid='$uid' and `dt`='$dt'")>0){ $totalx++; $zt = '已写'; $col = '#ff6600'; }else{ $dtjoin.=','.$dt.''; $zt = '未写'; $col = 'red'; } $totaly++; } $dtarra[$dt] = array($zt, $col); } $totalw = $totaly - $totalx; if($dtjoin!='')$dtjoin = substr($dtjoin, 1); $arr = array( 'uid' => $uid, 'totaly' => $totaly, 'totalx' => $totalx, 'totalw' => $totalw, 'dtjoin' => $dtjoin, 'month' => $mon, 'optdt' => $this->rock->now, 'optname' => $rs['name'] ); $rows[$uid] = array( 'arr' => $arr, 'dtarr' => $dtarra, ); if($addbo){ $where = "uid='$uid' and `month`='$mon'"; if($fxdb->rows($where)==0)$where=''; $fxdb->record($arr, $where); } } return $rows; } }